package com.omp.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.omp.common.dao.BaseDAO;
import com.omp.dao.ProductCatalogDAO;
import com.omp.entity.ProductCatalog;

@Repository
public class ProductCatalogDAOImpl extends BaseDAO<ProductCatalog, Integer> implements ProductCatalogDAO {

	@Override
	public void deleteByIndustryId(Integer industryId) {
		String hql = "delete ProductCatalog where industryId=?";
		batchExecute(hql, industryId);
	}

	@Override
	public List<ProductCatalog> findByIndustryId(Integer industryId) {
		String hql = "from ProductCatalog where industryId=?";
		return find(hql, industryId);
	}

	@Override
	public ProductCatalog findById(Integer industryId, Integer productId) {
		String hql = "from ProductCatalog where industryId=? and productId=?";
		return (ProductCatalog) findUnique(hql, industryId, productId);
	}

}